/**
 * ****************************** ICE *******************************
 * ========================================================================
 * Project:  basicsipcall
 * Package: org.ice4apps.talk.callManager.Features.Routing 
 * File:  ROrigInitiateInvite.java
 * Author: biju
 * Date: Feb 15, 2010
 * Description:
 * ========================================================================
 */
package org.ice4apps.talk.callManager.Features.Postprocess;

import java.util.Timer;

import javax.servlet.ServletException;
import javax.servlet.sip.Address;
import javax.servlet.sip.SipApplicationSession;
import javax.servlet.sip.SipServletRequest;
import javax.servlet.sip.SipSession;
import javax.servlet.sip.URI;
import javax.servlet.sip.SipFactory;


import org.ice4apps.util.IceLog;
import org.ice4apps.talk.callManager.IceTalkFeature;
import org.ice4apps.talk.callManager.UserSession;
import org.ice4apps.talk.entity.UserSessionMessage;

/**
 * @author biju
 * This worker object will be invoked when the Sate Machine receive 
 * Message : SIP INVITE 
 * Type : Originating 
 * State : Initiate 
 */
public class PostProxyInitiateInvite extends IceTalkFeature {
	

	/**
	 * @throws ServletException
	 */
	public PostProxyInitiateInvite(UserSession userSession) throws ServletException {
		super();
		this.userSession = userSession;
		// TODO Auto-generated constructor stub
	}

	/* (non-Javadoc)
	 * @see org.ice4apps.talk.callManager.IceTalkFeature#processMessage(org.ice4apps.talk.entity.UserSessionMessage)
	 */
	public void processMessage(UserSessionMessage msg) {

		SipServletRequest request = (SipServletRequest)msg.getMessage();
		try {
			IceLog.info(this.getClass(), "PROXY Sending Request ");
			request.send();
			IceLog.info(this.getClass(), "Sent Request ");
		} catch (Exception e) {
			// TODO : Add proper error
			//log.error("Error", e);
		}
		return;
	}

	private UserSession userSession;

}
